<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    span{
        border: 1px #444 solid;
        padding: 0 5px;
    }

</style>
<body>

<script>

    for ( i = 9; i >= 1; i--){
        for (j = 1; j <= i; j++){
            document.write("<span>" + j +"*"+ i +"="+ i*j +"</span>");
        }
        document.write("<br>");
    }

    for ( i = 1; i <= 9; i++){
        for (j = 1; j <= i; j++){
            document.write("<span>" + j +"*"+ i +"="+ i*j +"</span>");
        }
        document.write("<br>");
    }


</script>


</body>
</html>